<template>

<div class="container">
		<div ref="formTitle" class="form-flex">
      <el-form :inline="true" class="demo-form-inline">
        <el-form-item label="操作数字">
          <el-input v-model="num" placeholder="操作数字"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="addFn">加数</el-button>
          <el-button type="primary" @click="popFn">减数</el-button>
        </el-form-item>
      </el-form>

      <el-form :inline="true" class="demo-form-inline">
        <el-form-item label="改变管理员名字">
          <el-input v-model="name" placeholder="改变管理员名字"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="edit">确定</el-button>
        </el-form-item>
      </el-form>
    </div>
	</div>
  
</template>

<script>
import publics from '@/utils/public.js'
export default {
  data() {
    return {
      num:0,
      name:"",
    }
  },
  created () {
    this.num = this.$store.state.num
  },
  methods: {
    addFn(){
      console.log(this.$store.state.num)
      this.$store.commit('add');  //commit触发store里的函数
      this.num = this.$store.state.num
    },
    popFn(){
      console.log(this.$store.state.num)
      this.$store.commit('pop');//commit触发store里的函数
      this.num = this.$store.state.num
    },
    edit(){
      this.$store.commit("admin",this.name)
    }
  },
  mounted(){
  },
  
  computed: {

  }
}
</script>
<style>

  
</style>